﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RandomGeneratorForm
{
    public partial class RandomGeneratorForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GenerateNumber(object sender, EventArgs e)
        {
            try
            {
                Random generator = new Random();
                int from = int.Parse(this.fromNum.Text);
                int to = int.Parse(this.toNum.Text);
                this.result.Text = generator.Next(from,to).ToString();
            }
            catch (Exception)
            {
                this.result.Text = "Error";
            }
        }
    }
}